package com.chen.corejava.collection;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.PriorityQueue;
import java.util.Set;

/**
 *集合测试类
 *@author：email: <a href="cyb@ewppay.com"> Administrator </a> 
 *@Date 2017-2-17 下午3:55:09 
 */

public class Test {

	/**
	 * @param @param args   
	 * @return void  
	 * @throws
	 * @author cyb
	 * @date 2017-2-17
	 */
	public static void main(String[] args) {
		List<String> list = new ArrayList<String>();
		list.add("a");
		list.add("b");
		list.add("c");
		String[] arr = new String[list.size()];
		list.toArray(arr);
		for(String s : arr){
			System.out.println(s);
		}
		
		list.add("d");
		list.add("e");
		
		for(String str: list){
			System.out.println("str=" + str);
		}
		
		List<String> staff = new LinkedList<String>();
		staff.add("a1");
		staff.add("b1");
		staff.add("c1");
		staff.add("d1");
		for(String str: staff){
			System.out.println("str1=" + str);
		}
		staff.set(2, "w1");
		for(String str: staff){
			System.out.println("str2=" + str);
		}
		
		ListIterator iter = staff.listIterator();
		System.out.println("iter.nextIndex()=" + iter.nextIndex());
		iter.next();
		System.out.println("iter.nextIndex()=" + iter.nextIndex());
	
		PriorityQueue<String> pq = new PriorityQueue<String>();
		pq.add("e");
		pq.add("a");
		pq.add("b");
		for(String s : pq){
			System.out.println("s="+s);
		}
	}

}
